<?php

namespace App\Http\Controllers\staff;

use Illuminate\Http\Request;
use DB;
use Cookie;
use Hash;
use App\Http\Controllers\Controller;
//模型
use App\Models\Role;

class UserController extends Controller
{
    public function getIndex(Request $request){
        $staffInfo = $request -> cookie('staffInfo');
        //获取账号列表
            //查询管理区域
            $areaArr = DB::table('area_staff as as')
                -> leftJoin('area as a','a.id','=','as.area_id')
                -> where('staff_id',$staffInfo['id'])
                -> get();
            foreach($areaArr as $k=>$v){
                $areaArr[$k]['memberArr'] = DB::table('area_member as am')
                    -> leftJoin('member as m','m.id','=','am.member_id')
                    -> where('am.area_id',$v['area_id'])
                    -> where('m.ident',2)
                    -> get();
            }
            dd($areaArr);
    }


}